<script>
	import Vue from 'vue'
	import store from './store/index.js'
	import updateCustomBarInfo from './tuniao-ui/libs/function/updateCustomBarInfo.js'
	import { dinnerLogin } from './libs/js/api.js'
	export default {
		async onLaunch(config) {
			// const token = uni.getStorageSync('appIdToken');
			// if(token){
			// 	this.$store.commit('setToken', {
			// 		token
			// 	});
			// }else{
			// 	const url = window.location.href.split('?')[0];
			// 	if(!token){
			// 		if(!config.query.code){
			// 			window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf72523e0ddbcd156&redirect_uri=${encodeURIComponent(url)}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
			// 		}else{
			// 			console.log(config.query.code);
			// 			//发起网络请求
			// 			dinnerLogin({
			// 				code: config.query.code
			// 			}).then((res) => {
			// 				console.log(res);
			// 				if(res.data.token){
			// 					this.$store.commit('setToken', res.data);
			// 				}else{
			// 					// window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf72523e0ddbcd156&redirect_uri=${encodeURIComponent(url)}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
			// 				}
			// 			})
			// 		}
			// 	}
			// }
			
			uni.getSystemInfo({
			  success: function(e) {
			    // #ifndef H5
			    // 获取手机系统版本
			    const system = e.system.toLowerCase()
			    const platform = e.platform.toLowerCase()
			    // #endif
			  }
			})
      
			// 获取设备的状态栏信息和自定义顶栏信息
			// store.dispatch('updateCustomBarInfo')
			updateCustomBarInfo().then((res) => {
				console.log(res);
				store.commit('$tStore', {
					name: 'vuex_status_bar_height',
					value: res.statusBarHeight
				})
				store.commit('$tStore', {
					name: 'vuex_custom_bar_height',
					value: res.customBarHeight
				})
			})
		},
		onShow: function() {
			this.initLogin();
			// console.log('App Show')
		},
		onHide: function() {
			// console.log('App Hide')
		},
		methods: {
			initLogin() {
			},
			checkUpdate() {
			}
		}
	}
</script>

<style lang="scss">
  /* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
  @import './tuniao-ui/index.scss';
  @import './tuniao-ui/iconfont.css';
  @import './tuniao-ui/iconxiong.css';
  .uni-mask{
    background-color: rgba(0, 0, 0, 0.5) !important;
  }
  .tn-popup-class.tn-tags-pop{
    .tn-popup__close--top-right{
      top: 40rpx;
    }
  }
  .filter-collapse .tn-collapse-item__head{
	  justify-content: flex-start !important;
	  background-color: rgba(242, 242, 242, 1);
	  .tn-collapse-item__head__title.tn-text-ellipsis{
		  flex: none;
	  }
	  
  }
</style>
<style lang="scss">
  
</style>
